home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / develop / libsrc11.arc / RDBLKSPI.C < prev    next >
C/C++ Source or Header  |  1989-04-27  |  1KB  |  40 lines

  1. /*    rdblkspi.c 4.2        */
  2.  
  3. /*F****************************************************************************
  4.  
  5. FUNCTION NAME:    rdblkspi
  6.  
  7. ACTION:        Reads count characters from the SPI serial hardware to an
  8.         array of short.
  9.  
  10. PARAMETERS:    
  11.         array:    pointer to an array of bytes to be read from SPI
  12.             serial port.
  13.  
  14.         count:    number of bytes to read from the SPI port.
  15.  
  16. RETURNS:    (void)
  17.  
  18. ******************************************************************************/
  19.  
  20. #include <hc11/directives.h>
  21.  
  22. SMALL
  23. void rdblkspi(array, count)
  24.  
  25.     unsigned short    *array;        /* pointer to data to be read */
  26.     int        count;        /* number of bytes to be read */
  27.  
  28.     {
  29.  
  30.     /****************************************************************/
  31.     /*    Note that "while ((count--) > 0)" is equivalent to    */
  32.     /*    "while ((--count) >= 0)" but the pre-decrement version    */
  33.     /*    is more efficient than the post-decrement version.    */
  34.     /****************************************************************/
  35.  
  36.     while ((--count) >= 0)
  37.         *(array++) = rdbytspi();
  38.  
  39.     }    /* end of rdblkspi    */
  40.